#include "Brick.h"
#include "Listtexture.h"
#include "Define.h"

Brick::Brick(void){}
Brick::~Brick(void){}
Brick::Brick (int left, int top, int _id)
{
	sprite = new Sprite(Listtexture::BRICK,Listtexture::BRICK_WIDTH,Listtexture::BRICK_HEIGHT,
		Listtexture::BRICK_COUNT,Listtexture::BRICK_SPRITEPERROW);
	id = _id;
	type = _BRICK;
	width = Listtexture::BRICK_WIDTH;
	height = Listtexture::BRICK_HEIGHT;
	isCollide = true;
	UpdateRect(left,top,width,height);
	animateRate = Listtexture::BRICK_ANIMATE;
	lastAnimate = GetTickCount();
}
void Brick::update()
{
	DWORD now = GetTickCount();
	if(now - lastAnimate > animateRate)
	{
		sprite->Next();
		lastAnimate = now;
	}
}